package br.cns;

import java.util.HashMap;
import java.util.Map;

import br.cns.metrics.AlgebraicConnectivity;
import br.cns.metrics.AverageDegree;
import br.cns.metrics.AveragePathLength;
import br.cns.metrics.ClusteringCoefficient;
import br.cns.metrics.Density;
import br.cns.metrics.Diameter;
import br.cns.metrics.EigenValuesSum;
import br.cns.metrics.Entropy;
import br.cns.metrics.LinkEfficiency;
import br.cns.metrics.NaturalConnectivity;
import br.cns.metrics.OpticalNetworkCost;
import br.cns.metrics.Resilience;
import br.cns.metrics.SimtonBlockingProbability;

public class MetricFactory {
	private static Map<String, Metric> map = new HashMap<String, Metric>();
	
	private static final MetricFactory instance = new MetricFactory();
	
	public static MetricFactory getInstance(){
		return instance;
	}
	
	private MetricFactory(){
		if (map.isEmpty()){
			map.put(Diameter.getInstance().name(), Diameter.getInstance());
			map.put(AlgebraicConnectivity.getInstance().name(), AlgebraicConnectivity.getInstance());
			map.put(NaturalConnectivity.getInstance().name(), NaturalConnectivity.getInstance());
			map.put(AverageDegree.getInstance().name(), AverageDegree.getInstance());
			map.put(Density.getInstance().name(), Density.getInstance());
			map.put(ClusteringCoefficient.getInstance().name(), ClusteringCoefficient.getInstance());
			map.put(AveragePathLength.getInstance().name(), AveragePathLength.getInstance());
			map.put(Entropy.getInstance().name(), Entropy.getInstance());
			map.put(LinkEfficiency.getInstance().name(), LinkEfficiency.getInstance());
			map.put(OpticalNetworkCost.getInstance().name(), OpticalNetworkCost.getInstance());
			map.put(SimtonBlockingProbability.getInstance().name(), SimtonBlockingProbability.getInstance());
			map.put(EigenValuesSum.getInstance().name(), EigenValuesSum.getInstance());;
			map.put(Resilience.getInstance().name(), Resilience.getInstance());
		}
	}
	
	public Metric find(String metricName){
		return map.get(metricName);
	}
}
